package Chapter5;

//107页程序5.4
public class String_StringBufferTest {
    public static void main(String[] args) {
        String s = "This is a test String!";
        String t = s.toUpperCase();
        System.out.println("字符串为："+t);

        StringBuffer strb = new StringBuffer(s);
        System.out.println("strb的长度为："+strb.length());
        System.out.println("strb的容量为："+strb.capacity());

        String Z = new String(s);
        System.out.println("Z替换内容后为："+Z.replace('a','o'));
        StringBuffer strb1 = strb.replace(2,4,"at");
        System.out.println("strb1替换内容后为："+strb1);


    }
}